package mogiksaop.qliphoth.common;

import mogiksaop.qliphoth.BlockPlaceHandler;
import net.minecraftforge.common.MinecraftForge;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.Mod.Instance;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.network.NetworkRegistry;
import mogiksaop.qliphoth.common.core.proxy.CommonProxy;
import mogiksaop.qliphoth.common.entities.ModEntities;
import mogiksaop.qliphoth.common.lib.LibMisc;
import mogiksaop.qliphoth.common.network.GuiHandler;

@Mod(modid = LibMisc.MOD_ID, name = LibMisc.MOD_NAME, version = LibMisc.VERSION, useMetadata = true, acceptedMinecraftVersions = LibMisc.ACCEPTMCVER)
public enum Qliphoth
{
	INSTANCE;
	
	public static final Logger LOGGER = LogManager.getLogger("Qliphoth");
//    public static void main(String[] args){
//    }
    @Mod.InstanceFactory
    public static Qliphoth getInstance() {
        return INSTANCE;
    }
    //public static final String Name = LibMisc.MOD_NAME;
    private static Logger logger;

    @SidedProxy(clientSide = "mogiksaop.qliphoth.client.core.proxy.ClientProxy",serverSide = "mogiksaop.qliphoth.common.core.proxy.CommonProxy")
    public static mogiksaop.qliphoth.common.core.proxy.CommonProxy proxy;
	
    @Mod.Instance(LibMisc.MOD_ID)
    public static Qliphoth instance;
	
    @Mod.EventHandler
    public static void preInit(FMLPreInitializationEvent event)
    {
    	ModEntities.init();
        logger = event.getModLog();
        proxy.preInit(event);
    }

    @Mod.EventHandler
    public static void init(FMLInitializationEvent event)
    {
        logger.info("Mod initlialised :" + LibMisc.MOD_NAME);
        
        NetworkRegistry.INSTANCE.registerGuiHandler(Qliphoth.instance, new GuiHandler());
        
        MinecraftForge.EVENT_BUS.register(new BlockPlaceHandler());
        //proxy.registerRenderers();
        proxy.init(event);
    }
	
    @Mod.EventHandler
    public static void postInit(FMLPostInitializationEvent event)
    {
        proxy.postInit(event);
    }
}